﻿/*
绩点计算 
Time Limit:1000MS  Memory Limit:32768K

  
	Description:
	有一些班级学生的三门课程成绩，编程计算其绩点，并按绩点分数的高低排列。
	绩点计算公式为：（成绩小于60分，则该门课程的绩点为0）
	[(课程1 – 50)÷10×3 +(课程2 – 50)÷10×3 +(课程3 – 50)÷10×4]÷10 
	
Sample Input:
张三 89 62 71
李四 98 50 80
王五 67 88 91
Sample Output:
王五 67 88 91
李四 98 50 80
张三 89 62 71
*/


#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
using namespace std;

struct ScoreInfo
{
	string name;
	int score[3];
	friend ostream& operator << (ostream &os, const ScoreInfo &scoreInfo)
	{
		os<<scoreInfo.name<<" "
			<<scoreInfo.score[0]<<" "
			<<scoreInfo.score[1]<<" "
			<<scoreInfo.score[2];
		return os;
	}
	friend istream& operator >> (istream &is, ScoreInfo &scoreInfo)
	{
		is>>scoreInfo.name
			>>scoreInfo.score[0]
			>>scoreInfo.score[1]
			>>scoreInfo.score[2];

		return is;
	}
private:
	inline double getPoint(int i, double coef)
	{
		return score[i]<60 ? 0.0 : (score[i]-50)*coef;
	}
public:

	double PointBy10()
	{
		double sum=0.0;
		sum += getPoint(0, 0.3);
		sum += getPoint(1, 0.3);
		sum += getPoint(2, 0.4);
		return sum/10;
	}

};
/*
struct Comparator{
	bool operator()(ScoreInfo& si1, ScoreInfo& si2)
	{
		return (si1.PointBy10()-si2.PointBy10()) > 1e-6;
	}
};
*/
bool comparator( ScoreInfo& si1,  ScoreInfo& si2)
{

	return ((si1.PointBy10()) - (si2.PointBy10()))>1e-6;
}

int main()
{
	vector<ScoreInfo> vsi;
	vsi.reserve(10);

	for (ScoreInfo si;cin>>si;)
	{
		vsi.push_back(si);
	}
	
	sort(vsi.begin(), vsi.end(), comparator);

	for (vector<ScoreInfo>::iterator it = vsi.begin(); it != vsi.end(); ++it)
	{
		cout<<*it<<endl;
	}
	
	return 0;
}

